package forum.server.domain;

import java.io.Serializable;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableProperty;

/**
 * This class abstracts the contents of a certain post.
 * the content could be html, jpeg, plain text (string) and so on.
 * @author Tamir
 */
@Searchable(root=false)
public class PostContent implements Serializable{
	
	private static final long serialVersionUID = 1564335535279642933L;
	/**
     * For now, 'content' is a String.
     * later on it can be a more complex type.
     */
	@SearchableProperty (name = "content")
    private String content;
    
    /**
     * Creates a new PostContent which holds the content 'content'
     * @param content the content of the PostContent.
     */
    public PostContent(String content) {
        this.content = content;
    }

    /**
     * Creates an empty content.
     */
    public PostContent() {
        this.content = "";
    }

    
    
    /**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
     * @return a string representation of the class
     */
    @Override
    public String toString() {
        return this.content;
    }
    
    /**
     * @param o The other Object
     * @return 
     */
    @Override
    public boolean equals(Object o) {
    	return (o instanceof PostContent && ((PostContent)o).getContent().equals(this.content));
    }
}